<?php
declare (strict_types = 1);

namespace app\admin\model;

use thinkless\common\BaseModel;
use security\UserDetails;

/**
 * @Table tl_admin
 * @Comment 系统管理员
 * @Column(['name' => 'id', 'type' => 'integer', 'pk' => true, 'auto' => true ])
 * @Column(['name' => 'username', 'type' => 'varchar', 'length' => 50, 'comment' => '用户名' ])
 * @Column(['name' => 'is_super', 'type' => 'boolean', 'comment' => '是否超级管理员' ])
 * @Column(['name' => 'status', 'type' => 'integer', 'comment' => '状态' ])
 * @Column(['name' => 'mobile', 'type' => 'varchar', 'length' => 20, 'comment' => '手机号' ])
 * @Column(['name' => 'password', 'type' => 'varchar', 'length' => 50 ])
 * @Column(['name' => 'salt', 'type' => 'varchar', 'length' => 50 ])
 * @Column(['name' => 'avatar_url', 'type' => 'varchar', 'length' => 100 ])
 * @Column(['name' => 'login_token', 'type' => 'varchar', 'length' => 40 ])
 * @Column(['name' => 'last_login_time', 'type' => 'datetime', 'default' => 'CURRENT_TIMESTAMP' ])
 * @Column(['name' => 'last_login_ip', 'type' => 'varchar', 'length' => 40 ])
 * @Column(['name' => 'create_time', 'type' => 'datetime', 'default' => 'CURRENT_TIMESTAMP' ])
 */
class AdminModel extends BaseModel implements UserDetails {

    /**
     * @Option(['key' => 'status', 'label' => '正常'])
     */
    public const STATUS_NORMAL = 1;

    /**
     * @Option(['key' => 'status', 'label' => '禁用'])
     */
    public const STATUS_ABORT = 2;

    /**
     * @Option(['key' => 'status', 'label' => '离职'])
     */
    public const STATUS_LIZHI = 3;

    public function getAuthorities(): array {
        return $this->grantedAuthority;
    }

    public function getPassword(): string {
        return '';
    }

    public function getUsername(): string {
        return '';
    }

    public function isAccountNonExpired(): bool {
        return false;
    }
    
    public function isAccountNonLocked(): bool {
        return false;
    }
    
    public function isCredentialsNonExpired(): bool {
        return false;
    }
    
    public function isEnabled(): bool {
        return false;
    }
}
